<div class="card">
  <div class="card-header">
    添加数据
    <button class="btn btn-sm btn-primary" style="float:right;margin-right: 10px;" (click)="saveData()">保存</button>
  </div>
  <div class="card-body">
    <div [formGroup]="form">
      <div class="form-group row" *ngFor="let field of fields">
        <label for="staticEmail" class="col-sm-2 col-form-label">{{field.title}}</label>
        <div class="col-sm-10">
          <input type="text" [class.is-valid]="form.get(field.name).valid" [class.is-invalid]="!form.get(field.name).valid" [attr.placeholder]="field.placeholder"
            class="form-control" [formControlName]="field.name">
          <div [class.invalid-feedback]="!form.get(field.name).valid" [class.valid-feedback]="form.get(field.name).valid">
            {{field.empty}}!
          </div>
        </div>
      </div>
    </div>
  </div>
</div>